package com.eurasia.assignment.infrastructure.hoj;

import java.time.LocalDateTime;

import com.eurasia.assignment.domain.hoj.HOJJudgementStatus;
import com.fasterxml.jackson.databind.ObjectMapper;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;

@Entity
@Table(name = "hoj_single_case_judgement")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HOJSingleCaseJudgementEntity {
    
    private static final ObjectMapper objectMapper = new ObjectMapper();
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    @Column(name = "submitter_id", nullable = false)
    private Long submitterId;
    
    @Column(name = "test_judge_key", nullable = false)
    private String testJudgeKey;
    
    @Column(name = "code_info", columnDefinition = "JSON")
    private String codeInfo;
    
    @Column(name = "result", columnDefinition = "JSON")
    private String result;
    
    @Enumerated(EnumType.STRING)
    @Column(name = "status", nullable = false)
    private HOJJudgementStatus status;

    @CreationTimestamp
    private LocalDateTime createdAt;
    
    @Column(name = "problem_id")
    private Long problemId;
} 